//
//  TabBarController.swift
//  Xiaozihui
//
//  Created by 校企荟 on 2017/8/21.
//  Copyright © 2017年 校企荟. All rights reserved.
//

import UIKit

class TabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        addChildControllers()
    }

    private func addChildControllers() -> () {
        creatChildControllers(vc: HomeVC(), title: "", imageName: "Home_Tab_Icon0")
        creatChildControllers(vc: MineVC(), title: "", imageName: "Home_Tab_Icon1")
    }
    
    func creatChildControllers(vc: BaseVC , title: String, imageName: String) -> () {
        let nav = NavigationController(rootViewController: vc)
        nav.tabBarItem.title = title
        nav.tabBarItem.image = UIImage(named: "\(imageName)_N")?.withRenderingMode(.alwaysOriginal)
        nav.tabBarItem.selectedImage = UIImage(named: "\(imageName)_S")?.withRenderingMode(.alwaysOriginal)
        nav.tabBarItem.imageInsets = UIEdgeInsetsMake(7, 0, -7, 0)
        addChildViewController(nav);
    }
}
